{% extends "base-user.html" %}

{% block css%}    

{% endblock %}

{% block js%}  
{% endblock %}

{% block on_ready%}    
<script>
$(function() {
        //发出ajax请求  
        $("button").click( function(){  
            if($(this).attr('id') == 'open') {
                $.getJSON("{% url 'PiApp.api.nas_api' %}",  {cmd:'open'},
                 function(data){
                         if(data.cmd_ret == 'fail')
                            alert('FAIL')
                         if(data.cmd_ret == 'ok') {
                            alert('OK');
                            window.location.reload();
                            }
                      })     
            }
            else if ($(this).attr('id') == 'time') {
                 $.getJSON("{% url 'PiApp.api.nas_api' %}",  {cmd:'time'} ,function(data){           })         
            }          
           else if($(this).attr('id') == 'close') {
                $.getJSON("{% url 'PiApp.api.nas_api' %}",  {cmd:'close'},
                 function(data){
                         if(data.cmd_ret == 'fail')
                            alert('FAIL')
                         if(data.cmd_ret == 'ok') {
                            alert('OK');
                            window.location.reload();
                            }
                      })     
            }           
        }); 
});
</script>
{% endblock %}

{% block content %} 

<div class="row">      
    <div class="col-md-12">    


        <div class="box box-solid  box-primary box-frame">
            <div class="box-header">
                <i class="fa fa-th-large"></i>
                <h3 class="box-title">aria2 | yaaw</h3>
                <div class="box-tools pull-right">
                    <button class="btn btn-primary btn-sm"  id="open"><i class="fa fa-toggle-right">open_aria2</i></button>
                    <button class="btn btn-primary btn-sm"  id="close"><i class="fa fa-toggle-right">close_aria2</i></button>
                    <button class="btn btn-primary btn-sm"  id="time"><i class="fa fa-clock-o">time_paln</i></button>
                </div>
            </div>
            <div class="box-body no-padding ">
                <iframe src="/static/yaaw-master/index.html" frameBorder="0" width="100%" height="560px" ></iframe> 
            </div><!-- /.box-body-->
        </div><!-- /.box -->
    </div>

</div>




{% endblock %}
